//
//  MSQRCodeCell.m
//  觅尚
//
//  Created by No.8 on 2019/4/2.
//  Copyright © 2019 No.8. All rights reserved.
//

#import "MSQRCodeCell.h"

@implementation MSQRCodeCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    MSQRCodeCell * cell = [tableView dequeueReusableCellWithIdentifier:[MSQRCodeCell ID]];
    cell = [[MSQRCodeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[MSQRCodeCell ID]];
    cell.backgroundColor = backgroundcolor;
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setMember];
        
    }
    return self;
}
- (void)setMember{
    
    /** 背景*/
    self.BackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 300 * px)];
    self.BackView.backgroundColor = [UIColor clearColor];
    [self addSubview:self.BackView];
    
    
    /** 二维码*/
    self.QRCodeIMG = [[UIImageView alloc] initWithFrame:CGRectMake(30 * px, 30 * px, 200 * px, 200 * px)];
    self.QRCodeIMG.image = [UIImage imageNamed:@"财务-公司经营报表"];
    [self.BackView addSubview:self.QRCodeIMG];
    
    
    /** 昵称*/
    self.Namelabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.QRCodeIMG.frame) + 30 * px, self.QRCodeIMG.y, 500 * px, 50 * px)];
    self.Namelabel.textColor = [UIColor whiteColor];
    self.Namelabel.text = @"工作二维码";
    self.Namelabel.textAlignment = NSTextAlignmentLeft;
    self.Namelabel.font = [UIFont systemFontOfSize:SYRealValue(24 / 2)];
    [self.BackView addSubview:self.Namelabel];
    
    
    
    /** 所属商家*/
    self.businesslabel = [[UILabel alloc] initWithFrame:CGRectMake(self.Namelabel.x, CGRectGetMaxY(self.Namelabel.frame) + 20 * px, self.Namelabel.width, self.Namelabel.height)];
    self.businesslabel.textColor = [UIColor whiteColor];
    self.businesslabel.text = @"霄云壹号KTV";
    self.businesslabel.textAlignment = NSTextAlignmentLeft;
    self.businesslabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
    [self.BackView addSubview:self.businesslabel];
    
    
    /** 二维码*/
    self.AdressIMG = [[UIImageView alloc] initWithFrame:CGRectMake(self.Namelabel.x, CGRectGetMaxY(self.businesslabel.frame) + 20 * px, 50 * px, 50 * px)];
    self.AdressIMG.image = [UIImage imageNamed:@"定位"];
    [self.BackView addSubview:self.AdressIMG];
    
   
    /** 所属商家*/
    self.AdressLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.AdressIMG.frame) + 10 * px, self.AdressIMG.y, self.BackView.width * 0.7, self.AdressIMG.height)];
    self.AdressLabel.textColor = [UIColor whiteColor];
    self.AdressLabel.text = @"北京朝阳区将台镇高尔夫学校公园";
    self.AdressLabel.textAlignment = NSTextAlignmentLeft;
    self.AdressLabel.font = [UIFont systemFontOfSize:SYRealValue(24 / 2)];
    [self.BackView addSubview:self.AdressLabel];
    
   
    /** 背景*/
    self.LinView = [[UIView alloc] initWithFrame:CGRectMake(self.Namelabel.x, CGRectGetMaxY(self.AdressIMG.frame) + 50 * px, self.BackView.width- self.QRCodeIMG.width - 60 * px, 1)];
    self.LinView.backgroundColor = BackViewColor;
    [self.BackView addSubview:self.LinView];
    
    
    
}

- (void)setQRCodeModel:(MSQRCodeModel *)QRCodeModel{
    _QRCodeModel = QRCodeModel;
    [self.QRCodeIMG sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",QRCodeModel.qrcodeImg]] placeholderImage:[UIImage imageNamed:@"我的占位头像"]];
    
    self.businesslabel.text = [NSString stringWithFormat:@"%@",QRCodeModel.businessName];
    
    self.AdressLabel.text = [NSString stringWithFormat:@"%@",QRCodeModel.attendanceLocation];
}

+(NSString *)ID{
    return @"cell";
}

@end
